package com.lizhen.createpattern.builderpattern;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Meal {
    private List<Item> items = new ArrayList();

    public Meal() {
    }

    public void addItem(Item item) {
        this.items.add(item);
    }

    public float getCost() {
        float cost = 0.0F;

        Item item;
        for (Iterator var3 = this.items.iterator(); var3.hasNext(); cost += item.price()) {
            item = (Item) var3.next();
        }

        return cost;
    }

    public void showItems() {
        Iterator var2 = this.items.iterator();

        while (var2.hasNext()) {
            Item item = (Item) var2.next();
            System.out.print("Item : " + item.name());
            System.out.print(", Packing : " + item.packing().pack());
            System.out.println(", Price : " + item.price());
        }

    }
}
